package com.insta.java.webservice;

import java.util.List;

import javax.jws.WebService;

import com.tocea.formation.AuthorBean;
import com.tocea.formation.AuthorBeanService;
import com.tocea.formation.BookBean;
import com.tocea.formation.BookBeanService;
import com.tocea.formation.AuthorDTO;
import com.tocea.formation.BookDTO;


@WebService(endpointInterface= "com.insta.java.webservice.IBookWSD")
public class BookService implements IBookWSD {

	private AuthorBean authorPort;
	private BookBean	bookPort;
	
	public BookService(){
		authorPort = new AuthorBeanService().getAuthorBeanPort();
		bookPort = new BookBeanService().getBookBeanPort();
	}
	
	public void addBook(BookDTO b) {
		bookPort.addBook(b);
	}

	public void updateBook(BookDTO b) {
		bookPort.updateBook(b);
	}

	public void deleteBook(BookDTO b) {
		bookPort.deleteBook(b);
	}

	public List<BookDTO> findBook(String s) {
		return bookPort.findBook(s);
	}
	
	public List<BookDTO> getAllBook(){
		return null;
	}

	public boolean exists(String name) {
		return bookPort.exists(name);
	}

	public void addAuthor(AuthorDTO a) {
		authorPort.addAuthor(a);
	}

	public void updateAuthor(AuthorDTO a) {
		authorPort.updateAuthor(a);
	}

	public void deleteAuthor(AuthorDTO a) {
		authorPort.deleteAuthor(a);
	}

	public List<AuthorDTO> findByNameAuthor(String nom) {
		return authorPort.findByNameAuthor(nom);
	}

	public List<AuthorDTO> getAll() {
		return authorPort.getAll();
	}

	public List<AuthorDTO> findByBookAuthor(String nom) {
		return findByBookAuthor(nom);
	}
	
	

	public void addSimpleAuthor(String fn, String ln) {
		authorPort.addSimpleAuthor(fn, ln);
	}

	public void getAuthor(String _firstname, String _lastname) {
			
	}

}
